/*
 * @version: 
 * @Author: yu
 * @Date: 2023-07-10 15:58:42
 * @LastEditors: Andy
 * @LastEditTime: 2023-07-13 15:50:25
 */
//所有的接口封装到这个位置
//注意： 目前开发比较简单，几十个接口我们可以全部放置到这个文件内。如果工作有几百个接口的话，我们就可以分文件，eg: home.ts  index.ts  cate.ts
//引入封装好的axios类
import http from './index'



//!一、菜单管理
// 封装添加菜单请求
export const menuAdd = (data: any) => http.post('/menuadd', data)

// 菜单列表
export const menuList = () => http.get('/menulist?istree=true')

// 删除菜单
export const menuDel = (data: object) => http.post('/menudelete', data)

// 获取菜单
export const menuOne = (data: object) => http.get('/menuinfo', data)

// 修改菜单
export const menuUpdate = (data: object) => http.post('/menuedit', data)

// //!二、角色管理
//1.角色添加
export const roleAdd = (data: object) => http.post('/roleadd', data)

//2.角色列表
export const roleList = () => http.get('/rolelist')

//3.角色获取（一条）
export const roleInfo = (data: object) => http.get('/roleinfo', data)

//4.角色修改
export const roleEdit = (data: object) => http.post('/roleedit', data)

//5.角色删除
export const roleDel = (data: object) => http.post('/roledelete', data)

//!三、管理员管理
//1.管理员添加
export const userAdd = (data: object) => http.post('/useradd', data)

//2.管理员总数（用于计算分页
export const userCount = () => http.get('/usercount')

//3.管理员列表（分页）
export const userList = (data: object) => http.get('/userlist', data)

//4.管理员获取（一条）
export const userInfo = (data: object) => http.get('/userinfo', data)

//5.管理员修改
export const userEdit = (data: object) => http.post('/useredit', data)

//6.管理员删除
export const userDel = (data: object) => http.post('/userdelete', data)

//7.管理员登录
export const userLogin = (data: object) => http.post('/userlogin', data)


//!四、商品分类管理
//1.商品分类添加
export const cateAdd = (data: object) => http.post('/cateadd', data, true)

//2.商品分类列表
export const cateList = () => http.get('/catelist?istree=true')

//3.商品分类获取（一条）
export const cateInfo = (data: object) => http.get('/cateinfo', data)

//4.商品分类修改
export const cateEdit = (data: object) => http.post('/cateedit', data, true)

//5.商品分类删除
export const cateDel = (data: object) => http.post('/catedelete', data)


